<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#
" lang="zh_cn">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>推荐网盘同步盘数据加密工具restic | vitamind3 竹里馆</title>
<link href="../../assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
<link href="../../assets/css/ipython.min.css" rel="stylesheet" type="text/css">
<link href="../../assets/css/nikola_ipython.css" rel="stylesheet" type="text/css">
<meta name="theme-color" content="#5670d4">
<meta name="generator" content="Nikola (getnikola.com)">
<link rel="alternate" type="application/rss+xml" title="RSS" hreflang="zh_cn" href="../../rss.xml">
<link rel="canonical" href="https://vitamind3.gitee.io/posts/tui-jian-wang-pan-tong-bu-pan-shu-ju-jia-mi-gong-ju-restic/">
<!--[if lt IE 9]><script src="../../assets/js/html5.js"></script><![endif]--><meta name="author" content="vitamind3">
<link rel="prev" href="../shi-yong-c-interactivejiao-hu-shi-yun-xing-cdai-ma-shi-li/" title="使用C# Interactive交互式运行C#代码" type="text/html">
<link rel="next" href="../shang-hai-yi-qing-shu-ju-ke-shi-hua/" title="上海疫情数据可视化" type="text/html">
<meta property="og:site_name" content="vitamind3 竹里馆">
<meta property="og:title" content="推荐网盘同步盘数据加密工具restic">
<meta property="og:url" content="https://vitamind3.gitee.io/posts/tui-jian-wang-pan-tong-bu-pan-shu-ju-jia-mi-gong-ju-restic/">
<meta property="og:description" content="去年一直用的OneDrive做数据同步，但今年初OneDrive抽风了几次，于是又换回了国内的网盘。国内免费的支持同步功能的网盘挺多，这里不一一介绍。用国内网盘的优点是网络稳定，但数据安全方面并没有提供额外保障。 所以我又找了一款软件做数据加密，就是 restic 。


加密软件也很多，为啥选 restic ？

数据加密，不用多说了。
增量保存。每次提交都只新增修改的内容。这样的好处是每次修改">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2022-04-23T10:41:13+08:00">
<meta property="article:tag" content="PKM">
<meta property="article:tag" content="笔记软件">
</head>
<body>
<a href="#content" class="sr-only sr-only-focusable">跳到主内容</a>

<!-- Menubar -->

<nav class="navbar navbar-expand-md static-top mb-4
navbar-dark
bg-dark
"><div class="container">
<!-- This keeps the margins nice -->
        <a class="navbar-brand" href="../../">

            <span id="blog-title">vitamind3 竹里馆</span>
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="bs-navbar">
            <ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="../../pages/introduction" class="nav-link">欢迎</a>
                </li>
<li class="nav-item">
<a href="../../archive.html" class="nav-link">文章归档</a>
                </li>
<li class="nav-item">
<a href="../../categories/" class="nav-link">分类</a>
                </li>
<li class="nav-item">
<a href="../../rss.xml" class="nav-link">RSS 源</a>

                
            </li>
</ul>
<ul class="navbar-nav navbar-right"></ul>
</div>
<!-- /.navbar-collapse -->
    </div>
<!-- /.container -->
</nav><!-- End of Menubar --><div class="container" id="content" role="main">
    <div class="body-content">
        <!--Body content-->
        
        
        
<article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="." class="u-url">推荐网盘同步盘数据加密工具restic</a></h1>

        <div class="metadata">
            <p class="byline author vcard p-author h-card"><span class="byline-name fn p-name" itemprop="author">
                    vitamind3
            </span></p>
            <p class="dateline">
            <a href="." rel="bookmark">
            <time class="published dt-published" datetime="2022-04-23T10:41:13+08:00" itemprop="datePublished" title="2022-04-23 10:41">2022-04-23 10:41</time></a>
            </p>
            

        </div>
        

    </header><div class="e-content entry-content" itemprop="articleBody text">
    <div>
<p>去年一直用的OneDrive做数据同步，但今年初OneDrive抽风了几次，于是又换回了国内的网盘。国内免费的支持同步功能的网盘挺多，这里不一一介绍。用国内网盘的优点是网络稳定，但数据安全方面并没有提供额外保障。 所以我又找了一款软件做数据加密，就是 restic 。</p>
<!-- TEASER_END -->

<p>加密软件也很多，为啥选 restic ？</p>
<ol>
<li>
<strong>数据加密</strong>，不用多说了。</li>
<li>增量保存。每次提交都只新增修改的内容。这样的好处是每次修改都最是向网盘中添加内容，<strong>不会出现因同步问题导致的文件误删除</strong>。</li>
<li>适合网盘：restic会把文件合并切分为小块，不会出现单个较大的文件。</li>
<li>版本记录：每次提交的内容都可导出，类似于git版本管理。</li>
<li>开源免费，跨平台可用。</li>
</ol>
<h3>restic极简教程</h3>
<p>restic 官网在这里 <a href="https://restic.net/">restic · Backups done right!</a> ，开发语言是 GO 。</p>
<p>使用方法与git有些类似。第一步需要初始化一个仓库，按提示输入密码，就好了。</p>
<pre class="code literal-block"><span></span><code>restic init --repo C:/myrepo
</code></pre>

<p>需要备份数据的时候用backup命令，例如下面把 mydata 目录备份到 myrepo仓库中。</p>
<pre class="code literal-block"><span></span><code>restic -r C:/myrepo backup C:/mydata
</code></pre>

<p>要查看每次提交的记录，使用 snapshots 命令。每次提交是一个 snapshot 。在这里可看到每个 snapshots 的ID号。</p>
<pre class="code literal-block"><span></span><code>restic -r myrepo snapshots
</code></pre>

<p>要恢复数据出来使用 restore 命令。</p>
<pre class="code literal-block"><span></span><code>restic -r C:/myrepo restore 79766175 --target C:/tmp/restore-work
</code></pre>

<p>如果确认某些老版本备份已经没用，可用 forget 命令删除snapshot，再使用prune删除文件：</p>
<pre class="code literal-block"><span></span><code>restic -r C:/myrepo forget bdbd3439
restic -r C:/myrepo prune
</code></pre>

<p>那既然和git这么像，为什么不直接用 git ？restic 可以删除掉不需要的snapshot ，而git没有这个功能。</p>
<p>在和同步盘一起使用时注意：把restic仓库放入同步盘，每次使用时从 restic 中 恢复出最近的备份。</p>
<iframe width="668px" height="400px" src="//player.bilibili.com/player.html?aid=853486617&amp;bvid=BV1XL4y1V7aZ&amp;cid=582666440&amp;page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
</div>
    </div>
    <aside class="postpromonav"><nav><ul itemprop="keywords" class="tags">
<li><a class="tag p-category" href="../../categories/pkm/" rel="tag">PKM</a></li>
            <li><a class="tag p-category" href="../../categories/bi-ji-ruan-jian/" rel="tag">笔记软件</a></li>
        </ul>
<ul class="pager hidden-print">
<li class="previous">
                <a href="../shi-yong-c-interactivejiao-hu-shi-yun-xing-cdai-ma-shi-li/" rel="prev" title="使用C# Interactive交互式运行C#代码">上一篇文章</a>
            </li>
            <li class="next">
                <a href="../shang-hai-yi-qing-shu-ju-ke-shi-hua/" rel="next" title="上海疫情数据可视化">下一篇文章</a>
            </li>
        </ul></nav></aside></article><!--End of body content--><footer id="footer">
            Contents ©         <a href="https://vitamind3.gitee.io/">vitamind3</a> - Powered by         <a href="https://getnikola.com" rel="nofollow">Nikola</a>         
            
            
        </footer>
</div>
</div>


        <script src="../../assets/js/all-nocdn.js"></script><script>
    baguetteBox.run('div#content', {
        ignoreClass: 'islink',
        captions: function(element){var i=element.getElementsByTagName('img')[0];return i===undefined?'':i.alt;}});
    </script><script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?09027755f7478e129aec2cdd3acf9a4c";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>
